package test1;

//基类 Role
class Role {
    protected String name;       //姓名
    protected int age;
    //构造方法
    public Role() {
    }

    public Role(String name, int age) {
        this.name = name;
        this.age=age;
    }

    //Setter/Getter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //业务方法
    public void show(){
        System.out.println("我是"+name+"，年龄"+age+"岁。");
    }
}

//派生类 Faculty 教员
class Faculty extends Role{
    String number;
    int y;
    int m;
    int d;
    String zhichen;


    public Faculty(String name, int age, String number, int y, int m, int d, String zhichen) {
        super(name, age);
        this.number = number;
        this.y = y;
        this.m = m;
        this.d = d;
        this.zhichen = zhichen;
    }
    public void show(){
        System.out.println("我是"+name+"，年龄"+age+"岁。"+"工号是"+number+"，"+y+"年"+m+"月"+d+"日入职。是一名教师，"+zhichen+"职称。");
    }

}
//派生类 Student 学生
class Student extends Role{
    String number;
    String classes;

    public Student(String name, int age, String number, String classes) {
        super(name, age);
        this.number = number;
        this.classes = classes;
    }
    public void show(){
        System.out.println("我是"+name+"，年龄"+age+"岁。"+"学号是"+number+"，来自"+classes+"班。");
    }

}
//派生类 Staff 职员
class Staff extends Role{
    String number;
    int y;
    int m;
    int d;
    String chenghao;

    public Staff(String name, int age, String number, int y, int m, int d, String chenghao) {
        super(name, age);
        this.number = number;
        this.y = y;
        this.m = m;
        this.d = d;
        this.chenghao = chenghao;
    }

    public void show(){
        System.out.println("我是"+name+"，年龄"+age+"岁。"+"工号是"+number+"，"+y+"年"+m+"月"+d+"日入职。是一名"+chenghao+"。");
    }
}